package com.sky.controller.user;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.sky.constant.RedisConstant;
import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import com.sky.vo.LogicalField ;
import com.sky.utils.RedisCacheUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.statement.select.KSQLWindow;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

@RestController("userCategoryController")
@RequestMapping("user/category")
@Api(tags = "C端-分类接口")
@Slf4j
public class CategoryController {

    @Resource
    private CategoryService categoryService;



    /**
     * 查询分类
     * @param type
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("查询分类")
   // @Cacheable(value = "CategoryCache:type", key = "#type")//key的生成：userCache::1("")缓存框架
    public Result<List<Category>> list(Integer type) {
        return categoryService.list(type);
    }
}
